<?php /* Smarty version Smarty-3.1.18, created on 2017-09-05 16:53:02
         compiled from "/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/member.order_detail.html" */ ?>
<?php /*%%SmartyHeaderCode:26058661359735130da79d7-75612900%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '4eec8fa386c77aa49f16bfff05189a0dc7b734a8' => 
    array (
      0 => '/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/member.order_detail.html',
      1 => 1504601579,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '26058661359735130da79d7-75612900',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_5973513106faa3_70874495',
  'variables' => 
  array (
    'data' => 0,
    'g' => 0,
    'integral_order' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5973513106faa3_70874495')) {function content_5973513106faa3_70874495($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<body class="gr">

<div class="navBar">
	<a class="left" href="wap.php?app=member&act=order&integral_order=1"><i class="return"></i></a>
	<div class="titleView">订单详情</div>
	<?php if ($_smarty_tpl->tpl_vars['data']->value->shipping_company!='') {?><a class="right" href="wap.php?app=member&act=order_express&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
">物流</a><?php }?>
</div>

<div class="member-order-detail main-top">
	<ul class="groupView">
		<li>
			<div class="top"><?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
</div>
			<div class="address">
				<div>
					<span>收货人: <?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
　<?php echo $_smarty_tpl->tpl_vars['data']->value->mobile;?>
</span>
					<span><?php echo $_smarty_tpl->tpl_vars['data']->value->province;?>
<?php if ($_smarty_tpl->tpl_vars['data']->value->province!=$_smarty_tpl->tpl_vars['data']->value->city) {?> <?php echo $_smarty_tpl->tpl_vars['data']->value->city;?>
<?php }?> <?php echo $_smarty_tpl->tpl_vars['data']->value->district;?>
 <?php echo $_smarty_tpl->tpl_vars['data']->value->address;?>
</span>
				</div>
			</div>
		</li>
		
		<li>
			<ul>
				<?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value->goods; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?>
				<li class="ge-bottom ge-light">
					<div class="gview" price="<?php echo $_smarty_tpl->tpl_vars['g']->value->price;?>
" quantity="<?php echo $_smarty_tpl->tpl_vars['g']->value->quantity;?>
">
						<a href="wap.php?app=goods&act=detail&goods_id=<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_id;?>
" class="pic" style="background-image:url(<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_pic;?>
);"></a>
						<a href="wap.php?app=goods&act=detail&goods_id=<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_id;?>
" class="name right"><span class="price"><?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?>￥<?php echo number_format($_smarty_tpl->tpl_vars['g']->value->price,2);?>
<?php } else { ?><?php echo $_smarty_tpl->tpl_vars['g']->value->integral;?>
积分<?php }?></span><?php echo $_smarty_tpl->tpl_vars['g']->value->goods_name;?>
</a>
						<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?><div class="spec"><span>×<?php echo $_smarty_tpl->tpl_vars['g']->value->quantity;?>
</span><div>规格：<?php echo $_smarty_tpl->tpl_vars['g']->value->spec;?>
</div></div>
						<?php } else { ?><div class="spec"><div>规格：<?php echo $_smarty_tpl->tpl_vars['g']->value->spec;?>
</div></div><?php }?>
						<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?>
						<?php if ($_smarty_tpl->tpl_vars['data']->value->status==3||$_smarty_tpl->tpl_vars['data']->value->status==4) {?>
						<?php if ($_smarty_tpl->tpl_vars['g']->value->comment_time==0) {?>
						<div class="comment"><a href="wap.php?tpl=member.order_comment&order_id=<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
&goods_id=<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_id;?>
&goods_name=<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_name;?>
&goods_pic=<?php echo $_smarty_tpl->tpl_vars['g']->value->goods_pic;?>
"><span>评价</span></a></div>
						<?php } else { ?>
						<div class="comment"><font>已评价</font></div>
						<?php }?>
						<?php }?>
						<?php }?>
					</div>
				</li>
				<?php } ?>
			</ul>
			<div class="view">
				<div class="trans"><strong><?php if ($_smarty_tpl->tpl_vars['data']->value->shipping_price>0) {?>￥<?php echo number_format($_smarty_tpl->tpl_vars['data']->value->shipping_price,2);?>
<?php } else { ?>免邮<?php }?></strong><span>运费</span></div>
				<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?>
				<div class="total"><strong>￥<?php echo number_format($_smarty_tpl->tpl_vars['data']->value->total_price,2);?>
</strong><span>实付款(含运费)</span></div>
				<?php } else { ?>
				<div class="total"><strong><?php echo intval($_smarty_tpl->tpl_vars['data']->value->total_price);?>
积分</strong><span>总积分</span></div>
					<?php if ($_smarty_tpl->tpl_vars['data']->value->status==1) {?>
					<div class="order_cancel">
						<span cancel_id="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" status="<?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
">取消</span>
					</div>
					<?php }?>
				<?php }?>
			</div>
			<!--
			<div class="opr ge-top ge-light">
				<a class="im ge-right ge-light" href="javascript:void(0)" member_id="yanglanzi"><div><span>联系客服</span></div></a>
				<a class="tel" href="tel://<?php echo $_smarty_tpl->tpl_vars['data']->value->shop_mobile;?>
"><div><span>拨打电话</span></div></a>
			</div>
			-->
		</li>
		
		<?php if ($_smarty_tpl->tpl_vars['data']->value->shipping_number!='') {?>
		<li>
			<div class="info">
				<div>物流公司: <?php echo $_smarty_tpl->tpl_vars['data']->value->shipping_company;?>
</div>
				<div>物流单号: <?php echo $_smarty_tpl->tpl_vars['data']->value->shipping_number;?>
</div>
			</div>
		</li>
		<?php }?>
		
		<li>
			<div class="info">
				<div>订单状态: <span class="status status<?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
"><font><?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
</font><?php if ($_smarty_tpl->tpl_vars['data']->value->status>0&&$_smarty_tpl->tpl_vars['data']->value->ask_refund_time>0) {?> <span>(退货退款中)</span><?php }?></span></div>
				<div>订单编号: <?php echo $_smarty_tpl->tpl_vars['data']->value->order_sn;?>
</div>
				<div>创建时间: <?php echo $_smarty_tpl->tpl_vars['data']->value->add_time_str;?>
</div>
				<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->pay_time>0) {?><div>付款时间: <?php echo $_smarty_tpl->tpl_vars['data']->value->pay_time_str;?>
</div><?php }?>
				<?php if ($_smarty_tpl->tpl_vars['data']->value->shipping_time>0) {?><div>发货时间: <?php echo $_smarty_tpl->tpl_vars['data']->value->shipping_time_str;?>
</div><?php }?>
				<?php if ($_smarty_tpl->tpl_vars['data']->value->shouhuo_time>0) {?><div>成交时间: <?php echo $_smarty_tpl->tpl_vars['data']->value->shouhuo_time_str;?>
</div><?php }?>
			</div>
		</li>
	</ul>
	
	<?php if ((!isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->status>=0)||(isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->status==2)) {?>
	<div class="bottomView" mid="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
">
		<div class="ge-top ge-light">
			<?php if ($_smarty_tpl->tpl_vars['data']->value->status==0) {?>
			<a class="pay" href="javascript:void(0)" pay_method="<?php echo $_smarty_tpl->tpl_vars['data']->value->pay_method;?>
"><span>立即支付</span></a>
			<a class="cancel" href="javascript:void(0)"><span>取消订单</span></a>
			<form class="pay_form" action="wap.php?app=member&act=order_pay" method="post">
			<input type="hidden" name="re_order_sn" value="" />
			<input type="hidden" name="order_sn" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->order_sn;?>
" />
			<input type="hidden" name="price" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->total_price;?>
" />
			<input type="hidden" name="body" value="商富商城-订单" />
			</form>
			<form class="cancel_form" action="api.php?app=member&act=order_cancel" method="post">
			<input type="hidden" name="gourl" value="wap.php?app=member&act=order_detail&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			<input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			</form>
			<?php }?>
			<?php if ($_smarty_tpl->tpl_vars['data']->value->status==1) {?>
			<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->ask_refund_time==0) {?>
			<a class="refund" href="javascript:void(0)" total_price="<?php echo $_smarty_tpl->tpl_vars['data']->value->total_price;?>
" status="<?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
"><span>我要退款</span></a>
			<?php }?>
			<a class="ask" href="javascript:void(0)"><span>提醒商家发货</span></a>
			<form class="ask_form" action="api.php?app=order&act=ask_shipping" method="post">
			<input type="hidden" name="goalert" value="已提醒商家尽快发货，请耐心等待" />
			<input type="hidden" name="gourl" value="wap.php?app=member&act=order_detail&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			<input type="hidden" name="order_id" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			</form>
			<?php }?>
			<?php if ($_smarty_tpl->tpl_vars['data']->value->status==2) {?>
			<a class="ok" href="javascript:void(0)"><span>确认收货</span></a>
			<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->delay_shouhuo_time==0) {?>
			<a class="delay" href="javascript:void(0)"><span>延迟收货</span></a>
			<?php }?>
			<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)&&$_smarty_tpl->tpl_vars['data']->value->ask_refund_time==0) {?>
			<a class="refund" href="javascript:void(0)" total_price="<?php echo $_smarty_tpl->tpl_vars['data']->value->total_price;?>
" status="<?php echo $_smarty_tpl->tpl_vars['data']->value->status;?>
"><span>我要退款</span></a>
			<?php }?>
			<form class="delay_form" action="api.php?app=order&act=delay_shouhuo" method="post">
			<input type="hidden" name="goalert" value="已执行延迟收货操作" />
			<input type="hidden" name="gourl" value="wap.php?app=member&act=order_detail&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			<input type="hidden" name="order_id" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" />
			</form>
			<?php }?>
			<?php if ($_smarty_tpl->tpl_vars['data']->value->status>=3) {?>
			<a class="again" href="javascript:void(0)"><span>再次购买</span></a>
			<form class="again_form" action="api.php?app=cart&act=add_cart" method="post">
			<textarea style="display:none;"><?php echo json_encode($_smarty_tpl->tpl_vars['data']->value->goods);?>
</textarea>
			<input type="hidden" name="gourl" value="wap.php?app=coffee_cart&act=index" />
			<input type="hidden" name="goods" class="goods" value="" />
			</form>
			<?php }?>
		</div>
	</div>
	<?php }?>
</div>

<?php echo $_smarty_tpl->getSubTemplate ("footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<script>
function statusName(status){
	var name = '';
	switch(status*1){
		case -3:name = '已退货';break;
		case -2:name = '已退款';break;
		case -1:name = '取消';break;
		case 0:name = '待付款';break;
		case 1:name = '待发货';break;
		case 2:name = '待收货';break;
		case 3:
		case 4:name = '完成';break;
	}
	return name;
}
function setInfo(){
	$('.gview .pic').loadbackground();
	<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?>$('.view .total strong, .price').priceFont('bigPrice');<?php }?>
}
function order_cancel(id){

}
$(function(){
	setInfo();
	$('.info .status font, .top').html(function(i, html){ return statusName(html) });
	$('.opr .im').click(function(){
		var member_id = $(this).attr('member_id');
		location.href = '/wap.php?app=chat&act=talk';
		return false;
	});
	$('a.pay').click(function(){
		if($.browser.wechat && $(this).attr('pay_method')!='wxpay' && $(this).attr('pay_method')!='wxpay_h5'){
			alert('在微信上只能使用微信支付\n该订单下单时使用了支付宝方式');
			return false;
		}
		$('.pay_form').submit();
	});
	$('a.cancel').click(function(){
		if(!confirm('真的要取消吗？'))return false;
		$('.cancel_form').submit();
	});
	$('a.refund').click(function(){
		location.href = 'wap.php?tpl=member.order_refund&order_id='+$(this).parent().parent().attr('mid')+'&total_price='+$(this).attr('total_price')+'&status='+$(this).attr('status');
	});
	$('a.ask').click(function(){
		$('.ask_form').submit();
	});
	$('a.delay').click(function(){
		if(!confirm('确定需要延迟收货吗？'))return false;
		$('.delay_form').submit();
	});
	$('a.ok').click(function(){
		if(!confirm('<?php if (!isset($_smarty_tpl->tpl_vars['integral_order']->value)) {?>请收到货后，再确认收货！\n否则您可能钱货两空<?php } else { ?>确认收货吗？<?php }?>'))return false;
		$.postJSON('api.php?app=member&act=order_shouhuo', { id:$(this).parent().parent().attr('mid') }, function(json){
			if(json.error!=0){ $.overloadError(json.msg);return }
			location.href = location.href;
		});
	});
	$('a.again').click(function(){
		$.overload(null);
		var count = 0, breaker = false, data = $('.again_form textarea').val().formatJSON(), arr = [];
		if(!$.isArray(data))return false;
		for(var i=0; i<data.length; i++){
			(function(j){
				$.postJSON('api.php?app=cart&act=cart_total', { goods_id:data[j].goods_id, spec:data[j].spec }, function(json){
					if(breaker)return;
					if(json.error!=0){ $.overloadError(json.msg);breaker = true;return }
					if(json.data*1+1 > data[j].stocks){ $.overloadError('库存不足');breaker = true;return }
					var goods = { goods_id:data[j].goods_id, spec:data[j].spec, quantity:1 };
					arr.push(goods);
					count++;
					if(count == data.length){
						var val = { goods:arr };
						$('.goods').val($.jsonString(val));
						$('.again_form').submit();
					}
				});
			})(i);
		}
	});
	$('.order_cancel > span').click(function(){
		if(!confirm('确定需要取消订单吗？'))return false;
		var _thisId = $(this).attr('cancel_id');
		var _thisStatus = $(this).attr('status');
		if(!_thisId || _thisStatus != 1)return false;
		$.postJSON('api.php?app=member&act=order_cancel', { id:_thisId }, function(json){
			if(json.error!=0){
				$.overloadError(json.msg);
				return; 
			}else{
				location.reload();
			}
		});
	});
});
</script>
<?php }} ?>
